/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package VIEW;

import BEANS.ComboItem;
import CONTROLLERS.AdjustmentController;
import UTIL.InputValidator;
import java.awt.event.KeyEvent;
import javax.swing.JComboBox;
import javax.swing.JTable;

/**
 *
 * @author weak_2030
 */
public class AdjustmentsNew extends javax.swing.JPanel {
    AdjustmentController adjustmentController;
    /**
     * Creates new form AdjustmentsNew
     */
    public AdjustmentsNew() {
        initComponents();
        adjustmentController = new AdjustmentController(jTable2, jTable3, jLabel14, 
                jLabel16, jLabel18, jLabel20, jComboBox3, jTextField3, dateChooserCombo4, 
                singleAdjustment, jTextArea3, dateTo, dateFrom, historyTable, categoryFilter,
                supplierFilter, clearMark, searchInput);
        adjustmentHistoryDialog.setLocationRelativeTo(null);
        singleAdjustment.setLocationRelativeTo(null);
        InputValidator.enabler(jTable2, jButton2);
        InputValidator.enabler2(jTable3, clear);
        InputValidator.enabler2(jTable3, adjust);
        InputValidator.enabler(jTable3, delete);
        adjustmentController.justDClickIt(jTable2);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDialog1 = new javax.swing.JDialog();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        adjustmentHistoryDialog = new javax.swing.JDialog();
        jLabel7 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        historyTable = new javax.swing.JTable();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        dateFrom = new datechooser.beans.DateChooserCombo();
        dateTo = new datechooser.beans.DateChooserCombo();
        singleAdjustment = new javax.swing.JDialog();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jButton9 = new javax.swing.JButton();
        Adjust = new javax.swing.JButton();
        jComboBox3 = new javax.swing.JComboBox();
        jTextField3 = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jCheckBox1 = new javax.swing.JCheckBox();
        jLabel1 = new javax.swing.JLabel();
        jButton8 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        clearMark = new javax.swing.JLabel();
        categoryFilter = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        supplierFilter = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        searchInput = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        dateChooserCombo4 = new datechooser.beans.DateChooserCombo();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        jLabel5 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTable3 = new javax.swing.JTable();
        jButton2 = new javax.swing.JButton();
        clear = new javax.swing.JButton();
        delete = new javax.swing.JButton();
        adjust = new javax.swing.JButton();
        jLabel24 = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        jTextArea3 = new javax.swing.JTextArea();

        jLabel6.setText("Remarks");

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane4.setViewportView(jTextArea1);

        jButton5.setText("Adjust");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jButton6.setText("Cancel");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
        jDialog1.getContentPane().setLayout(jDialog1Layout);
        jDialog1Layout.setHorizontalGroup(
            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDialog1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                    .addGroup(jDialog1Layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jDialog1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton6)))
                .addContainerGap())
        );
        jDialog1Layout.setVerticalGroup(
            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDialog1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton5)
                    .addComponent(jButton6))
                .addContainerGap(35, Short.MAX_VALUE))
        );

        adjustmentHistoryDialog.setTitle("Adjustment History");
        adjustmentHistoryDialog.setBounds(new java.awt.Rectangle(0, 0, 900, 600));
        adjustmentHistoryDialog.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        adjustmentHistoryDialog.setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel7.setText("Adjustment History");

        historyTable.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        historyTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Date", "Product Name", "Operation", "Quantity adjusted", "Reason"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, true, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        historyTable.setRowHeight(20);
        jScrollPane5.setViewportView(historyTable);

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel9.setText("From:");

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel10.setText("To:");

        dateFrom.setWeekStyle(datechooser.view.WeekDaysStyle.FULL);
        dateFrom.addSelectionChangedListener(new datechooser.events.SelectionChangedListener() {
            public void onSelectionChange(datechooser.events.SelectionChangedEvent evt) {
                dateFromOnSelectionChange(evt);
            }
        });
        dateFrom.addCommitListener(new datechooser.events.CommitListener() {
            public void onCommit(datechooser.events.CommitEvent evt) {
                dateFromOnCommit(evt);
            }
        });

        dateTo.setWeekStyle(datechooser.view.WeekDaysStyle.FULL);
        dateTo.addSelectionChangedListener(new datechooser.events.SelectionChangedListener() {
            public void onSelectionChange(datechooser.events.SelectionChangedEvent evt) {
                dateToOnSelectionChange(evt);
            }
        });
        dateTo.addCommitListener(new datechooser.events.CommitListener() {
            public void onCommit(datechooser.events.CommitEvent evt) {
                dateToOnCommit(evt);
            }
        });

        javax.swing.GroupLayout adjustmentHistoryDialogLayout = new javax.swing.GroupLayout(adjustmentHistoryDialog.getContentPane());
        adjustmentHistoryDialog.getContentPane().setLayout(adjustmentHistoryDialogLayout);
        adjustmentHistoryDialogLayout.setHorizontalGroup(
            adjustmentHistoryDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(adjustmentHistoryDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(adjustmentHistoryDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 880, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, adjustmentHistoryDialogLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(dateFrom, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(dateTo, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(10, 10, 10)))
                .addContainerGap())
        );
        adjustmentHistoryDialogLayout.setVerticalGroup(
            adjustmentHistoryDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(adjustmentHistoryDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7)
                .addGap(18, 18, 18)
                .addGroup(adjustmentHistoryDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9)
                    .addComponent(jLabel10)
                    .addComponent(dateFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dateTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)
                .addContainerGap())
        );

        singleAdjustment.setTitle("Adjust Product Count");
        singleAdjustment.setBounds(new java.awt.Rectangle(0, 0, 500, 380));
        singleAdjustment.setMinimumSize(new java.awt.Dimension(415, 350));
        singleAdjustment.setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);
        singleAdjustment.setResizable(false);

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel13.setText("Product Name:");

        jLabel14.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel14.setText("jLabel14");

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel15.setText("Supplier:");

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel16.setText("jLabel16");

        jLabel17.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel17.setText("Category:");

        jLabel18.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel18.setText("jLabel18");

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel19.setText("Current Quantity:");

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel20.setText("jLabel20");

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel21.setText("Adjustment Operation:");

        jLabel23.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel23.setText("Adjustment Value:");

        jButton9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton9.setText("Cancel");
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        Adjust.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        Adjust.setText("Adjust");
        Adjust.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AdjustActionPerformed(evt);
            }
        });

        jComboBox3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Add", "Subtract" }));

        jTextField3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jTextField3.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextField3KeyPressed(evt);
            }
        });

        jLabel25.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel25.setText("Remarks:");

        jTextArea2.setColumns(20);
        jTextArea2.setRows(5);
        jScrollPane1.setViewportView(jTextArea2);

        jCheckBox1.setText("Save this remark");

        javax.swing.GroupLayout singleAdjustmentLayout = new javax.swing.GroupLayout(singleAdjustment.getContentPane());
        singleAdjustment.getContentPane().setLayout(singleAdjustmentLayout);
        singleAdjustmentLayout.setHorizontalGroup(
            singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(singleAdjustmentLayout.createSequentialGroup()
                .addGap(55, 55, 55)
                .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(singleAdjustmentLayout.createSequentialGroup()
                        .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(singleAdjustmentLayout.createSequentialGroup()
                                .addGap(82, 82, 82)
                                .addComponent(jLabel25)
                                .addGap(18, 18, 18))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, singleAdjustmentLayout.createSequentialGroup()
                                .addComponent(jCheckBox1)
                                .addGap(5, 5, 5)))
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE))
                    .addGroup(singleAdjustmentLayout.createSequentialGroup()
                        .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(singleAdjustmentLayout.createSequentialGroup()
                                .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel21)
                                    .addComponent(jLabel19)
                                    .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel13)
                                        .addComponent(jLabel15, javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jLabel17, javax.swing.GroupLayout.Alignment.TRAILING))
                                    .addComponent(jLabel23))
                                .addGap(18, 18, 18)
                                .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel16)
                                    .addComponent(jLabel14)
                                    .addComponent(jLabel18)
                                    .addComponent(jLabel20)
                                    .addComponent(jComboBox3, 0, 136, Short.MAX_VALUE)
                                    .addComponent(jTextField3)))
                            .addGroup(singleAdjustmentLayout.createSequentialGroup()
                                .addGap(82, 82, 82)
                                .addComponent(Adjust)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jButton9)))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        singleAdjustmentLayout.setVerticalGroup(
            singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(singleAdjustmentLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(jLabel14))
                .addGap(18, 18, 18)
                .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(jLabel16))
                .addGap(18, 18, 18)
                .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel18)
                    .addComponent(jLabel17))
                .addGap(18, 18, 18)
                .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(jLabel20))
                .addGap(18, 18, 18)
                .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel23)
                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(singleAdjustmentLayout.createSequentialGroup()
                        .addComponent(jLabel25)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jCheckBox1))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(singleAdjustmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Adjust)
                    .addComponent(jButton9))
                .addContainerGap(116, Short.MAX_VALUE))
        );

        setBackground(new java.awt.Color(204, 204, 204));
        setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Adjustments");
        add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(266, 11, 379, -1));

        jButton8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton8.setText("Adjustment History");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });
        add(jButton8, new org.netbeans.lib.awtextra.AbsoluteConstraints(703, 17, -1, -1));

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel2.setText("Category:");
        add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 60, -1, -1));

        clearMark.setIcon(new javax.swing.ImageIcon(getClass().getResource("/UI ICONS/xmark.png"))); // NOI18N
        clearMark.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                clearMarkMouseClicked(evt);
            }
        });
        add(clearMark, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 150, -1, -1));

        categoryFilter.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        categoryFilter.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        categoryFilter.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                categoryFilterItemStateChanged(evt);
            }
        });
        categoryFilter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                categoryFilterActionPerformed(evt);
            }
        });
        add(categoryFilter, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 60, 220, -1));

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel3.setText("Supplier:");
        add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 100, -1, -1));

        supplierFilter.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        supplierFilter.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        supplierFilter.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                supplierFilterItemStateChanged(evt);
            }
        });
        supplierFilter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                supplierFilterActionPerformed(evt);
            }
        });
        add(supplierFilter, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 100, 220, -1));

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel4.setText("Inventory Product List:");
        add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 150, -1, -1));

        searchInput.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        searchInput.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                searchInputKeyPressed(evt);
            }
        });
        add(searchInput, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 150, 165, -1));

        jButton3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton3.setText("Search");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 150, -1, -1));

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel11.setText("Date:");
        add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 100, -1, -1));

        dateChooserCombo4.setFormat(0);
        dateChooserCombo4.setWeekStyle(datechooser.view.WeekDaysStyle.FULL);
        add(dateChooserCombo4, new org.netbeans.lib.awtextra.AbsoluteConstraints(530, 100, 176, -1));

        jTable2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Product Id", "Product Name", "Supplier", "Type", "Quantity"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable2.setRowHeight(20);
        jScrollPane2.setViewportView(jTable2);
        if (jTable2.getColumnModel().getColumnCount() > 0) {
            jTable2.getColumnModel().getColumn(4).setMaxWidth(200);
        }

        add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 180, 404, 350));

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel5.setText("Products Selected:");
        add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 150, -1, -1));

        jTable3.setAutoCreateRowSorter(true);
        jTable3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jTable3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Product Name", "Supplier", "Quantity", "Adjusted to", "id", "type", "count", "operation", "reason"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable3.setRowHeight(20);
        jScrollPane3.setViewportView(jTable3);

        add(jScrollPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 180, 400, 287));

        jButton2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton2.setText("Add");
        jButton2.setEnabled(false);
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 540, 80, -1));

        clear.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        clear.setText("Clear All");
        clear.setEnabled(false);
        clear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clearActionPerformed(evt);
            }
        });
        add(clear, new org.netbeans.lib.awtextra.AbsoluteConstraints(760, 150, -1, -1));

        delete.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        delete.setText("Delete");
        delete.setEnabled(false);
        delete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteActionPerformed(evt);
            }
        });
        add(delete, new org.netbeans.lib.awtextra.AbsoluteConstraints(670, 150, -1, -1));

        adjust.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        adjust.setText("Adjust");
        adjust.setEnabled(false);
        adjust.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                adjustActionPerformed(evt);
            }
        });
        add(adjust, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 540, -1, -1));

        jLabel24.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel24.setText("Remarks:");
        add(jLabel24, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 470, -1, -1));

        jTextArea3.setColumns(20);
        jTextArea3.setRows(5);
        jScrollPane7.setViewportView(jTextArea3);

        add(jScrollPane7, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 490, 400, 45));
    }// </editor-fold>//GEN-END:initComponents

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton6ActionPerformed

    private void adjustActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_adjustActionPerformed
        adjustmentController.confirmAdjustmentDialog();
        InputValidator.enabler(jTable2, jButton2);
        InputValidator.enabler2(jTable3, clear);
        InputValidator.enabler2(jTable3, adjust);
        InputValidator.enabler(jTable3, delete);
    }//GEN-LAST:event_adjustActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        adjustmentController.searchProduct();
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        adjustmentController.updateHistoryReport();
        adjustmentHistoryDialog.setVisible(true);
    }//GEN-LAST:event_jButton8ActionPerformed

    private void AdjustActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AdjustActionPerformed
        adjustmentController.adjustEntries();
        InputValidator.enabler(jTable2, jButton2);
        InputValidator.enabler2(jTable3, clear);
        InputValidator.enabler2(jTable3, adjust);
        InputValidator.enabler(jTable3, delete);
    }//GEN-LAST:event_AdjustActionPerformed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
        singleAdjustment.dispose();
    }//GEN-LAST:event_jButton9ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        adjustmentController.adjustDialog();
        InputValidator.enabler(jTable2, jButton2);
        InputValidator.enabler2(jTable3, clear);
        InputValidator.enabler2(jTable3, adjust);
        InputValidator.enabler(jTable3, delete);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void clearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearActionPerformed
        adjustmentController.clearList();
        InputValidator.enabler(jTable2, jButton2);
        InputValidator.enabler2(jTable3, clear);
        InputValidator.enabler2(jTable3, adjust);
        InputValidator.enabler(jTable3, delete);
    }//GEN-LAST:event_clearActionPerformed

    private void supplierFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_supplierFilterActionPerformed
        
    }//GEN-LAST:event_supplierFilterActionPerformed

    private void categoryFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_categoryFilterActionPerformed
        
    }//GEN-LAST:event_categoryFilterActionPerformed

    private void categoryFilterItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_categoryFilterItemStateChanged
        adjustmentController.filterProducts();
    }//GEN-LAST:event_categoryFilterItemStateChanged

    private void supplierFilterItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_supplierFilterItemStateChanged
        adjustmentController.filterProducts();
    }//GEN-LAST:event_supplierFilterItemStateChanged

    private void dateFromOnSelectionChange(datechooser.events.SelectionChangedEvent evt) {//GEN-FIRST:event_dateFromOnSelectionChange
        adjustmentController.updateHistoryReport();
    }//GEN-LAST:event_dateFromOnSelectionChange

    private void dateToOnSelectionChange(datechooser.events.SelectionChangedEvent evt) {//GEN-FIRST:event_dateToOnSelectionChange
        adjustmentController.updateHistoryReport();
    }//GEN-LAST:event_dateToOnSelectionChange

    private void dateFromOnCommit(datechooser.events.CommitEvent evt) {//GEN-FIRST:event_dateFromOnCommit
        adjustmentController.updateHistoryReport();
    }//GEN-LAST:event_dateFromOnCommit

    private void dateToOnCommit(datechooser.events.CommitEvent evt) {//GEN-FIRST:event_dateToOnCommit
        adjustmentController.updateHistoryReport();
    }//GEN-LAST:event_dateToOnCommit

    private void clearMarkMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clearMarkMouseClicked
        adjustmentController.clearSearch();
    }//GEN-LAST:event_clearMarkMouseClicked

    private void deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteActionPerformed
        adjustmentController.removeSelectedRow();
        InputValidator.enabler(jTable2, jButton2);
        InputValidator.enabler2(jTable3, clear);
        InputValidator.enabler2(jTable3, adjust);
        InputValidator.enabler(jTable3, delete);
    }//GEN-LAST:event_deleteActionPerformed

    private void jTextField3KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField3KeyPressed
        if (evt.getKeyCode()== KeyEvent.VK_ENTER)
	{
            Adjust.doClick();
	}
    }//GEN-LAST:event_jTextField3KeyPressed

    private void searchInputKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchInputKeyPressed
        if (evt.getKeyCode()== KeyEvent.VK_ENTER)
	{
            jButton3.doClick();
	}
    }//GEN-LAST:event_searchInputKeyPressed

    public static JTable getAdjustmentsTable(){
        return jTable2;
    }
    
    public static JComboBox<ComboItem> getFilterCategoryComboBox(){
        return categoryFilter;
    }
    
    public static JComboBox<ComboItem> getFilterSupplierComboBox(){
        return supplierFilter;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Adjust;
    private javax.swing.JButton adjust;
    private javax.swing.JDialog adjustmentHistoryDialog;
    private static javax.swing.JComboBox categoryFilter;
    private javax.swing.JButton clear;
    private javax.swing.JLabel clearMark;
    private datechooser.beans.DateChooserCombo dateChooserCombo4;
    private datechooser.beans.DateChooserCombo dateFrom;
    private datechooser.beans.DateChooserCombo dateTo;
    private javax.swing.JButton delete;
    private javax.swing.JTable historyTable;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JComboBox jComboBox3;
    private javax.swing.JDialog jDialog1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane7;
    private static javax.swing.JTable jTable2;
    private javax.swing.JTable jTable3;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JTextArea jTextArea3;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField searchInput;
    private javax.swing.JDialog singleAdjustment;
    private static javax.swing.JComboBox supplierFilter;
    // End of variables declaration//GEN-END:variables
}
